package com.mall.impl;

import java.util.ArrayList;

import com.mall.core.Item;
import com.mall.util.Id;
import com.mall.util.Name;

public class ShopingCart implements com.mall.core.ShopingCart{
private ArrayList<Item> shopingcartitem = null;
private Id id = null;

//gets an item out of the Shopingcart
	public Item getItem(Id id) {
		Item retrieveditem = null;
		for(Item item: shopingcartitem){
			if(item.getID().compareTo(id)==1){
				 shopingcartitem.remove(item);
				retrieveditem = item; 
			}
		}
		return retrieveditem;
		
	}

// returns the amount of items in the shoping cart
	public int getItemCount() {
		// TODO Auto-generated method stub
		return shopingcartitem.size();
	}
// adds items to the shopping cart
public void setItem(Item item) {
			shopingcartitem.add(item);
	}
// set the id of the shoping cart
	public void setId(Id id) {
		// TODO Auto-generated method stub
		this.id=id;
	}

	@Override
	public Name getName() {
		return null ;
	}



@Override
public Id getID() {
	// TODO Auto-generated method stub
	return id;
}

@Override
public void setName(Name name) {
	// TODO Auto-generated method stub
	
}

	

	

	
}
